<?php 
if(KT!='KhiThe') exit;
class systems_model extends khithe_mysql{

	public function getLogin($_POST)
	{	
		$user = parent::checkStrMySQL($_POST['username']);
		$pass = parent::checkStrMySQL($_POST['password']);
		
		$query_Login = "SELECT * FROM ".users." WHERE Username = '".$user."' AND Password = '".md5($pass)."' AND `Status`='True' AND (`Mod`='Admin' OR `Mod`='Members') ";
		$Login = parent::selectMySQL($query_Login);	
		$row = mysql_fetch_assoc($Login);
		
		parent::CloseConnection();
		
		return $row;
	}

    public function getCookiesLogin($arr)
    {
        $user =trim( parent::checkStrMySQL($arr['username']) );
        $pass =trim( parent::checkStrMySQL($arr['password']) );
        $id =trim(parent::checkStrMySQL($arr['id']));

        $query_Login = "SELECT * FROM ".users." WHERE ID='".$id."' AND Username = '".$user."' AND Password = '".$pass."' AND `Status`='True' AND (`Mod`='Admin' OR `Mod`='Members') ";
        $Login = parent::selectMySQL($query_Login);
        $row = mysql_fetch_assoc($Login);

        return $row;
    }
	
	public function get_setting()
	{	
		$row_settings = array();
		
		$query_settings = "SELECT * FROM ".settings;
		$settings = parent::selectMySQL($query_settings);		
		return $settings;
	}
	
	public function updateInsertSet($arr)
	{
		foreach($arr as $SettingID=>$SettingConfig)
		{
			$SettingID = parent::checkStrMySQL($SettingID);
			$SettingConfig = parent::checkStrMySQL($SettingConfig);
			
			$query = "UPDATE ".settings." SET SettingConfig='".$SettingConfig."' WHERE SettingID = '".trim($SettingID)."'";
			$query = parent::UpdateInsertMySQL($query);
		}
		
		parent::CloseConnection();
		return $query;
		
	}
	
	
}
?>